const db=require('./db.js');


const Product={};


Product.getProductInfo=function (param,callback) { 
    let sql='select * from products limit ?,?';
    db.query(sql,[param.page,param.pageSize],(err,result)=>{
        if(err)return console.log(err);
        callback(err,{
            rows:result,
            total:result.length,
            page: param.page,
            pageSize: param.pageSize
        });
    })
 }
Product.getProductListsById=function (id,callback) {
    db.query('select * from products where pro_id=?',id,(err,result)=>{
        if(err)return console.log(err);
        // console.log(result);
        callback(err,result);
    })
  }

  module.exports=Product;